package acwing.位运算;

import java.util.Scanner;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/11/12
 */
public class Main {

    private static final int N = 100010;

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        while (n-- != 0) {
            int x = s.nextInt();
            int res = 0;
            while (x != 0) {
                x -= lowbit(x);
                res++;
            }
            System.out.println(res + "");
        }
    }
    private static int lowbit(int x) {
        return x & -x;
    }
}
